#pragma once

#include "DB/DBExecHelper.h"
#include "../GameReportManager.h"

struct DBAccountData
{
	UInt64		_id;
	UInt32		_card;
	std::string	_unionid;
	std::string _passwd;
	UInt64		_promoter;
	UInt8		_accType;
	std::string	_nick;
	std::string	_icon;
};

struct DBPlayerData
{
	UInt64		_id;
	std::string	_nick;
	UInt8		_sex;
	std::string	_headIcon;
	UInt32		_rid;
	std::string	_reports;
	UInt32		_loginTime;
	UInt32		_createdTime;
};

struct DBRoomData
{
	UInt32	_id;
	UInt32	_sid;
	UInt64	_ownerId;
	UInt32	_turn;
	UInt32	_remainTurn;
	UInt8	_huType;
	UInt8	_zx;
	UInt8	_hzlz;
	UInt8	_qxd;
	UInt8	_zn;
	std::string	_uids;
	UInt32	_createdTime;
};

struct DBGReportData
{
	UInt32	_id;
	GPlayerData _gpds[4];
	UInt32	_time;
};

struct DBFetchCardData
{
	UInt64	_account;
	UInt32	_card;
};

struct DBServerData
{
	UInt32		_id;
	std::string _name;
	UInt8		_type;
	std::string _innterIp;
	std::string _outerIp;
	UInt16		_port;
	UInt16		_roomCount;
	UInt16		_onlineCount;
};

struct DBConfigData
{
	std::string _key;
	std::string _value;
};


SPECIALBEGIN(DBAccountData)
SPECIALDEF(8)
(
	UInt64, _id,
	UInt32, _card,
	std::string, _unionid,
	std::string, _passwd,
	UInt64, _promoter,
	UInt8, _accType,
	std::string, _nick,
	std::string, _icon
)
SPECIALEND()

SPECIALBEGIN(DBPlayerData)
SPECIALDEF(8)
(
	UInt64, _id,
	std::string, _nick,
	UInt8, _sex,
	std::string, _headIcon,
	UInt32, _rid,
	std::string, _reports,
	UInt32, _loginTime,
	UInt32, _createdTime
)
SPECIALEND()

SPECIALBEGIN(DBRoomData)
SPECIALDEF(12)
(
	UInt32, _id,
	UInt32,	_sid,
	UInt64, _ownerId,
	UInt32, _turn,
	UInt32, _remainTurn,
	UInt8, _huType,
	UInt8, _zx,
	UInt8, _hzlz,
	UInt8, _qxd,
	UInt8, _zn,
	std::string, _uids,
	UInt32, _createdTime
)
SPECIALEND()

SPECIALBEGIN(DBGReportData)
SPECIALDEF(14)
(
	UInt32, _id,
	UInt64, _gpds[0]._uid,
	std::string, _gpds[0]._nick,
	Int32, _gpds[0]._score,
	UInt64, _gpds[1]._uid,
	std::string, _gpds[1]._nick,
	Int32, _gpds[1]._score,
	UInt64, _gpds[2]._uid,
	std::string, _gpds[2]._nick,
	Int32, _gpds[2]._score,
	UInt64, _gpds[3]._uid,
	std::string, _gpds[3]._nick,
	Int32, _gpds[3]._score,
	UInt32, _time
)
SPECIALEND()

SPECIALBEGIN(DBServerData)
SPECIALDEF(8)
(
	UInt32, _id,
	std::string, _name,
	UInt8, _type,
	std::string, _innterIp,
	std::string, _outerIp,
	UInt16, _port,
	UInt16, _roomCount,
	UInt16, _onlineCount
)
SPECIALEND()

SPECIALBEGIN(DBConfigData)
SPECIALDEF(2)
(
	std::string, _key,
	std::string, _value
)
SPECIALEND()